.todo-input {
    display: flex;
    gap: .5rem;
    max-width: 480px;
    margin: 1rem auto;
    padding: .75rem 1rem;
    background: #ffffff38;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
    transition: box-shadow .3s ease;
}

.todo-input:focus-within {
    box-shadow: 0 4px 16px rgba(59, 130, 246, .25);
}

.todo-input input {
    flex: 1 1 auto;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: .6rem .9rem;
    font-size: 1rem;
    outline: none;
    transition: border-color .3s ease, transform .2s ease;
}

.todo-input input:focus {
    border-color: #3b82f6;
    transform: scale(1.02);
}

/* ----- 图标按钮（合并后） ----- */
.todo-input .action-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    box-shadow: 0 2px 8px rgba(59, 130, 246, .35);
    cursor: pointer;
    font-size: 1.6rem;
    font-weight: 300;
    color: #fff;
    display: grid;
    place-content: center;
    transition: transform .2s ease, background .3s ease;
}

.todo-input .action-btn:hover {
    transform: translateY(-2px);
}

.todo-input .action-btn:active {
    transform: translateY(0);
}

/* 有内容 → 红色 ✕ + 脉冲 */
.todo-input input:not(:placeholder-shown)~.action-btn {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
    box-shadow: 0 2px 8px rgba(248, 113, 113, .4);
    animation: pulse .6s ease;
}

/* 脉冲动画 */
@keyframes pulse {
    0% {
        transform: scale(.95);
        box-shadow: 0 0 0 0 rgba(248, 113, 113, .5);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(248, 113, 113, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(248, 113, 113, 0);
    }
}

/* 删除动画（JS 触发） */
@keyframes fadeOut {
    0% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

.todo-input.deleting input {
    animation: fadeOut .25s ease forwards;
}

/* 移动端微调 */
@media (max-width: 480px) {
    .todo-input {
        padding: .5rem .75rem;
    }

    .todo-input input,
    .todo-input .action-btn {
        font-size: .95rem;
    }

    .todo-input .action-btn {
        width: 40px;
        height: 40px;
        font-size: 1.4rem;
    }

    .todo-input input:not(:placeholder-shown)~.action-btn::before {
        font-size: 1.1rem;
    }
}